package com.vone.ui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.geom.RoundRectangle2D;
import javax.swing.JComboBox;

@SuppressWarnings("rawtypes")
public class MyComboBox extends JComboBox {
	
	private int round=0;

	private static final long serialVersionUID = 1L;
	 public MyComboBox(){
		  super();
		  init();
	 }
    @Override
    public void updateUI() {
        setUI(new MyComboBoxUI());
    }
	 @SuppressWarnings("unchecked")
	private void init(){
	  setOpaque(true);
	  setUI(new MyComboBoxUI());
	  setRenderer(new MyComboBoxRenderer());
	  setBackground(Color.white);
	  setForeground(new Color(39,157,227));
	 }
	 public Dimension getPreferredSize(){
	  return super.getPreferredSize();
	 }
	 
	 public void paint(Graphics g){
			RoundRectangle2D rect = new RoundRectangle2D.Double(0,0,getWidth(),getHeight(),round,round);
	        g.setClip(rect);
	    	super.paint(g);
	 }
	 
	 public void paintBorder(Graphics g){
		 super.paintBorder(g);
		 g.setColor(new Color(39,157,227));
		 g.drawRoundRect(0, 0, getWidth()-1, getHeight()-1,round,round);
	 }
	public int getRound() {
		return round;
	}
}
